min
Find the minimum value
min()
returns the minimum value.
In this example, we will use min()
to return the minimum value of the two specified numbers:
<?php echo ( min ( 5 , 7 ) ) ; echo ( min ( - 3 , 5 ) ) ; echo ( min ( - 3 , - 5 ) ) ; echo ( min ( 7.25 , 7.30 ) ) ; ?>
Try it yourself
min ( x , y )
parameter | describe |
---|---|
x | Required. A number. |
y | Required. A number. |
min()
returns the smallest value in the parameter.
If there is only one parameter and is an array, min()
returns the smallest value in the array. If the first parameter is an integer, string, or floating point number, at least two parameters are required and min()
returns the smallest of these values. An infinite number of values can be compared.